<?php
require_once 'xs_sdk/lib/XS.php';
    $xs = new XS('pattern');
    $search = $xs->search; // 获取 搜索对象

    $search->setQuery(''); // 设置搜索语句
    //$search->addRange('grammage', 6, 10);
    //$search->setSort('pid');
    //$search->setQuery('widthheight:5');
    //$search->addRange('widthheight', null, 15);
    $search->setLimit(20, 0);
    //$docs = $search->setFuzzy()->search();
    echo $search->getQuery();
    $docs = $search->search();
    //echo $search->lastCount;


    // 必须在 search() 之后调用

    foreach ($docs as $doc) {
        $item = $doc->getFields();
        print_r($item);
    }


    //$tokenizer = new XSTokenizerScws();   // 直接创建实例
    //$text = '1001,1002,2000';
    //$words = $tokenizer->getResult($text);
    //print_r($words);